﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;
public partial class Use_Use_AddNew : System.Web.UI.Page
{
    /// <summary>
    /// 用户的id 
    /// </summary>
    string id;
    /// <summary>
    /// 
    /// 用户名
    /// </summary>
    string use;
    /// <summary>
    /// 数据操作通用类 实例 TextData
    /// </summary> 
    public TongUse TextData = new TongUse();

    /// <summary>
    /// 系统安装绝对路径
    /// </summary>
    public string Abs_Path = TongUse.SysPath;

    protected void Page_Load(object sender, EventArgs e)
    {



        ChangePwd();//更新密码

    }

    /// <summary>
    /// 更新密码
    /// </summary>
    protected void ChangePwd()
    {


        if (pwd.Value.Trim() != "" && useX.Value != "")
        {
            if (TextData.SqlataSet("select uid from [use] where uid = '" + useX.Value+"'").Tables[0].Rows.Count == 0)//看看有没有注册这个用户
            {
                //添加新用户
                TextData.SqlDataSave("insert into  [Use] (uid,UseName,pwd) values('" + useX.Value + "','" + Use_Name.Value + "','" + TextData.SHA1Sign(pwd.Value.Trim()) + "')");
                tt.Text = "添加用户" + useX.Value + "的数据成功";
            }
            else
            {
                tt.Text = "  用户" + useX.Value + " 已存在";
            }
        }
        else
        {
            tt.Text = "";
        }
    }
}
